package com.chanyachting.emall.form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

import com.chanyachting.emall.util.RequestUtil;

public class BusinesstypeForm extends ActionForm {
	
	// primary key
	private java.lang.Integer id;

	// fields
	private java.lang.Integer pri;
	private java.lang.String name;
	private java.lang.String summary;
	
	
	
	
	public java.lang.Integer getId() {
		return id;
	}
	public void setId(java.lang.Integer id) {
		this.id = id;
	}
	public java.lang.Integer getPri() {
		return pri;
	}
	public void setPri(java.lang.Integer pri) {
		this.pri = pri;
	}
	public java.lang.String getName() {
		return name;
	}
	public void setName(java.lang.String name) {
		this.name = name;
	}
	public java.lang.String getSummary() {
		return summary;
	}
	public void setSummary(java.lang.String summary) {
		this.summary = summary;
	}
	
	
	@Override
	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {
		// TODO Auto-generated method stub
		
		ActionErrors errors=new ActionErrors();
		
		if(name==null || name.trim().equals("")){
			
			errors.add("sellname", new ActionMessage("errors.businesstype.nameEmpty")); 
			
			new RequestUtil(request).setMsg("name must not null!");
		}
		
		
		return errors;
	}
	
	
	
	
	
	
	

}
